#import <Foundation/Foundation.h>

@class KxOAuthEngine, KxOAuthController;

@protocol KxOAuthControllerDelegate <NSObject>
@optional
- (void) OAuthController: (UIViewController *) controller authenticatedWithUsername: (NSString *) username;
- (void) OAuthControllerFailed: (UIViewController *) controller;
- (void) OAuthControllerCanceled: (UIViewController *) controller;
@end

@interface KxOAuthController : UIViewController <UIWebViewDelegate> {
	
	KxOAuthEngine						*_engine;
	UIWebView									*_webView;
	UINavigationBar								*_navBar;
	
	id <KxOAuthControllerDelegate>			_delegate;
	UIView										*_blockerView;
	
	UIInterfaceOrientation                      _orientation;
	BOOL										_loading, _firstLoad;
	UIToolbar									*_pinCopyPromptBar;
	
}

@property (nonatomic, readwrite, retain) KxOAuthEngine *engine;
@property (nonatomic, readwrite, assign) id <KxOAuthControllerDelegate> delegate;
@property (nonatomic, readonly) UINavigationBar *navigationBar;

+ (KxOAuthController *) controllerToEnterCredentialsWithEngine: (KxOAuthEngine *) engine 
													delegate: (id <KxOAuthControllerDelegate>) delegate;
+ (BOOL) credentialEntryRequiredWithEngine: (KxOAuthEngine *) engine;

- (NSString *) getStringFromUrl: (NSString*) url needle:(NSString *) needle;

@end
